/*
 * Copyright (c) csii.com.cn 2016 zhaojin
 */

'use strict';
requirejs.config({
    baseUrl: (document.getElementById('contextPath').value + "/build/js"),
    paths: {
        'zepto': 'bower_components/zepto/zepto',
        'touch': 'bower_components/zeptotouch/zepto-touch',
        'jquery': 'bower_components/jquery/jquery.min',
        'domReady': 'mainpro',
        'underscore': 'mainpro',
        'app': 'mainpro',
        'zepto-custom': 'zepto-custom',
        'SparkMD5': 'bower_components/SparkMD5/spark-md5'
    },
    map: {
        '*': {
            'zepto': 'zepto-custom'
        }, 'zepto-custom': {
            'zepto': 'zepto'
        }
    },
    shim: {
        'underscore': {
            exports: '_'
        },
        'jquery': {
            exports: 'jQuery'
        },
        'zepto': {
            exports: 'Zepto'
        },
        'touch': {
            deps: ['zepto']
        },
        'detect': {
            deps: ['zepto']
        }, 'zepto-custom': {
            exports: ['$']
        }

    },
    waitSeconds: 30,
    onError: function (err) {
        console.error(err);
    }
});

require([
    'domReady!',
    'app',
    document.getElementById('viewPairedScriptPath').value
], function (doc, app, view) {
    app.init();
    if (!!view) {
        view.init();
    } else {
        console.warn('view is undefined!!');
    }
});